﻿///////////////////////////////////////////////////////////////////////////////////////////////
// System.Text.Parsing - © 2011 Sebastien Pellizzari
// Released under the MIT License (http://www.opensource.org/licenses/mit-license.php)
///////////////////////////////////////////////////////////////////////////////////////////////
using System.IO;

namespace System.Text.Parsing
{
    /// <summary>Represents the base class for an object that processes tokenizer definitions and generates code and data.</summary>
    public abstract class GrammarTokenizerProcessor : GrammarProcessorBase
    {
        //-----------------------------------------------------------------------
        //     Methods
        //-----------------------------------------------------------------------

        /// <summary>When overridden in a derived class, generates source code for design time generation in specified language for specified grammar.</summary>
        /// <param name="languageName">The name of the language of the source code to generate.</param>
        /// <param name="codeNamespace">The namespace of the source code to generate.</param>
        /// <param name="textWriter">The <see cref="TextWriter"/> object to use to generate the source code.</param>
        /// <param name="grammar">The tokenizer definition.</param>
        /// <returns>true if the generation succeeded; false otherwise.</returns>
        public abstract bool GenerateDesignTimeSourceCode(string languageName, string codeNamespace, TextWriter textWriter, GrammarTokenizer grammar);
        
        /// <summary>When overridden in a derived class, generates source code for compile time generation in specified language for specified grammar.</summary>
        /// <param name="languageName">The name of the language of the source code to generate.</param>
        /// <param name="codeNamespace">The namespace of the source code to generate.</param>
        /// <param name="textWriter">The <see cref="TextWriter"/> object to use to generate the source code.</param>
        /// <param name="grammar">The tokenizer definition.</param>
        /// <returns>true if the generation succeeded; false otherwise.</returns>
        public abstract bool GenerateCompileTimeSourceCode(string languageName, string codeNamespace, TextWriter textWriter, GrammarTokenizer grammar);
    }
}
